package com.mt.mall.entity.good;

import javax.persistence.*;
import java.io.Serializable;
import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import com.mt.common.system.entity.Attachment;
import com.mt.common.system.entity.User;
import com.mt.mall.entity.good.Commodity;

@DEntity(label="购物车",comment="",moduleLabel="购物车")
@Entity(name="mall_shopping_cart")
@Table(name = "mall_shopping_cart" , indexes = { @Index(name = "index_commodity_id", columnList = "commodity_id"),@Index(name = "index_attachments_id", columnList = "attachments_id"),@Index(name = "index_user_id", columnList = "user_id")  })
@ApiModel(description = "购物车:")
public class ShoppingCart extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;
	//status 0代表正常 1代表删除 2代表已结算
	@DColumn(index=3,label="商品",foreignEntity="Commodity",comment="",component="对象选择",where=true)
	@ApiModelProperty(value = "商品:")
	@Column(name="commodity_id",length=255,nullable=false,unique=false)
	private Long commodityId;

	@Transient
	private Commodity commodity;

	@Transient
	@ApiModelProperty(value = "商品名称:")
	@DColumn(index=3,label="商品",foreignEntity="Commodity",comment="")
	private String commodityName;

	@DColumn(index=4,label="规格",comment="将所选择的规格用-拼接",component="文本",where=false)
	@ApiModelProperty(value = "规格:将所选择的规格用-拼接")
	@Column(name="specification",length=255,nullable=true,unique=false)
	private String specification;

	@DColumn(index=5,label="附件",foreignEntity="Attachment",comment="附件",component="文本",where=false)
	@ApiModelProperty(value = "附件:附件")
	@Column(name="attachments_id",length=255,nullable=true,unique=false)
	private Long attachmentsId;

	@Transient
	private Attachment attachments;

	@Transient
	@ApiModelProperty(value = "附件名称:附件")
	@DColumn(index=5,label="附件",foreignEntity="Attachment",comment="附件")
	private String attachmentsName;

	@DColumn(index=6,label="购买用户",foreignEntity="User",comment="购买用户",component="对象选择",where=true)
	@ApiModelProperty(value = "购买用户:购买用户")
	@Column(name="user_id",length=255,nullable=false,unique=false)
	private Long userId;

	@Transient
	private User user;

	@Transient
	@ApiModelProperty(value = "购买用户名称:购买用户")
	@DColumn(index=6,label="购买用户",foreignEntity="User",comment="购买用户")
	private String userName;

	@DColumn(index=7,label="数量",comment="数量",component="文本",where=false)
	@ApiModelProperty(value = "数量:数量")
	@Column(name="count",length=255,nullable=false,unique=false)
	private Integer count;


	public Long getCommodityId() {
		return this.commodityId;
	}

	public void setCommodityId(Long commodityId) {
		this.commodityId = commodityId;
	}

	public String getSpecification() {
		return this.specification;
	}

	public void setSpecification(String specification) {
		this.specification = specification;
	}

	public Long getAttachmentsId() {
		return this.attachmentsId;
	}

	public void setAttachmentsId(Long attachmentsId) {
		this.attachmentsId = attachmentsId;
	}

	public Long getUserId() {
		return this.userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Integer getCount() {
		return this.count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	public Commodity getCommodity() {
		return this.commodity;
	}

	public void setCommodity(Commodity commodity) {
		if(commodity == null){
		}
		else
		{
		this.commodityId = commodity.getEid();
		this.commodity = commodity;		
		}
}

	public String getCommodityName() {
		return this.commodityName;
	}

	public void setCommodityName(String commodityName) {
		this.commodityName = commodityName;
	}

	public Attachment getAttachments() {
		return this.attachments;
	}

	public void setAttachments(Attachment attachments) {
		if(attachments == null){
		}
		else
		{
		this.attachmentsId = attachments.getEid();
		this.attachments = attachments;		
		}
}

	public String getAttachmentsName() {
		return this.attachmentsName;
	}

	public void setAttachmentsName(String attachmentsName) {
		this.attachmentsName = attachmentsName;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		if(user == null){
		}
		else
		{
		this.userId = user.getEid();
		this.user = user;		
		}
}

	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}



}
